using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Fireball.Syntax;

namespace AjGenesisStudio.Commands
{
    class PrintPreviewCommand : Command
    {

        public override bool Execute()
        {
            return Execute(Global.Instance.MainForm.GetActiveDocument());
        }

        public bool Execute(Documents.Document doc)
        {
            if (doc == null)
                return true;

            Global.Instance.StartWork("Printing");

            SourceCodePrintDocument printdoc = new SourceCodePrintDocument();
            PrintPreviewDialog dlg = new PrintPreviewDialog();
            
            printdoc.Document = doc.syntaxdoc;
            dlg.Document = printdoc;
            
            Global.Instance.EndWork();

            dlg.ShowDialog();

            return true;
        }

    }
}
